<?php

namespace App\Providers;

use App\Models\ContentDB\Content;
use App\Models\SociatyDB\Hall;
use App\Models\MainDB\Auction\Auction;
use App\Models\MainDB\Auction\AuctionGift;
use App\Models\MainDB\Auction\AuctionTime;
use App\Models\MainDB\Auction\AuctionRecord;
use App\Models\MainDB\Auction\AuctionContent;
use App\Models\MainDB\DataUserOnlineDaily;
use App\Models\MainDB\Protect\ProtectGetRewardLog;
use App\Models\MainDB\Protect\ProtectUserCard;
use App\Models\MainDB\Protect\ProtectUserCardLog;
use App\Models\MainDB\Protect\ProtectUserRelation;
use App\Models\MainDB\RewardItem;
use App\Models\MainDB\RewardDetail;
use App\Models\MainDB\RewardItemType;
use App\Models\MainDB\WeekStarReward;
use App\Models\MainDB\Chat;
use App\Models\MainDB\RoomStayDelay;
use App\Models\MainDB\RewardLog;
use App\Models\MainDB\WeekStar;
use App\Models\MainDB\WeekStarHistory;
use App\Models\MainDB\Badge;
use App\Models\MainDB\Reward;
use App\Models\MainDB\BadgeUser;
use App\Models\MainDB\BadgeType;
use App\Models\MainDB\AlipayAuth;
use App\Models\MainDB\RewardType;
use App\Models\MainDB\RoomPitZego;
use App\Models\MainDB\TreasureLog;
use App\Models\MainDB\GameEntrance;
use App\Models\MainDB\SmsHistory;
use App\Models\MainDB\ProductGroup;
use App\Models\MainDB\BadgeExchange;
use App\Models\MainDB\ScoreMallNews;
use App\Models\MainDB\ShumeiCallback;
use App\Models\MainDB\Task\TaskConfig;
use App\Models\MainDB\Task\TaskModule;
use App\Models\MainDB\Task\TaskType;
use App\Models\MainDB\Task\TaskUser;
use Elasticsearch\Client;
use Elasticsearch\ClientBuilder;
use Illuminate\Support\ServiceProvider;
use App\Models\MainDB\Admin;

//引入Admin模型
use App\Models\MainDB\AdminMenu;

//引入菜单模型
use App\Models\MainDB\AdminPermission;

//引入权限模型
use App\Models\MainDB\AdminRole;


//引入七夕模型
use App\Models\MainDB\RoomBackground;
use App\Models\MainDB\RoomBanned;
use App\Models\MainDB\RoomBlacklist;
use App\Models\MainDB\RoomCardiac;
use App\Models\MainDB\RoomChange;
use App\Models\MainDB\RoomCharm;
use App\Models\MainDB\RoomFavorite;
use App\Models\MainDB\RoomForbid;
use App\Models\MainDB\RoomGuide;
use App\Models\MainDB\RoomJoin;
use App\Models\MainDB\RoomJoinTime;
use App\Models\MainDB\RoomKickout;
use App\Models\MainDB\RoomLabel;
use App\Models\MainDB\RoomLockLog;
use App\Models\MainDB\RoomPit;
use App\Models\MainDB\RoomPitApply;
use App\Models\MainDB\RoomPopularity;
use App\Models\MainDB\RoomReport;
use App\Models\MainDB\RoomSeal;
use App\Models\MainDB\RoomSoundEffect;
use App\Models\MainDB\RoomType;
use App\Models\MainDB\SensitiveContent;
use App\Models\MainDB\Sign;
use App\Models\MainDB\SmsMessage;
use App\Models\MainDB\SysMessages;
use App\Models\MainDB\SystemMessage;
use App\Models\MainDB\User;
use App\Models\MainDB\UserSignin;
use App\Models\MainDB\UserAccountChange;
use App\Models\MainDB\UserAuth;
use App\Models\MainDB\UserAvatar;
use App\Models\MainDB\UserBank;
use App\Models\MainDB\UserChange;
use App\Models\MainDB\UserConfig;
use App\Models\MainDB\UserData;
use App\Models\MainDB\UserDataCopy;
use App\Models\MainDB\UserDevice;
use App\Models\MainDB\UserDress;
use App\Models\MainDB\UserExp;
use App\Models\MainDB\UserFlop;
use App\Models\MainDB\UserLabel;
use App\Models\MainDB\UserNews;
use App\Models\MainDB\UserNobility;
use App\Models\MainDB\UserPhoto;
use App\Models\MainDB\UserRank;
use App\Models\MainDB\UserRecharge;
use App\Models\MainDB\UserReport;
use App\Models\MainDB\UserRoom;
use App\Models\MainDB\UserRoomSpecial;
use App\Models\MainDB\UserSeal;
use App\Models\MainDB\UserSearch;
use App\Models\MainDB\UserSociety;
use App\Models\MainDB\UserToken;
use App\Models\MainDB\UserVerify;
use App\Models\MainDB\UserVisit;
use App\Models\MainDB\UserWithdraw;
use App\Models\MainDB\VirusBoss;
use App\Models\MainDB\VirusBossPrize;
use App\Models\MainDB\VirusChancePrize;
use App\Models\MainDB\VirusChest;
use App\Models\MainDB\VirusNextPrize;
use App\Models\MainDB\VirusPrice;
use App\Models\MainDB\VirusThisPrize;
use App\Models\MainDB\VirusUniqueUser;
use App\Models\MainDB\ScoreMallExchange;
use App\Models\MainDB\ProductGroupDetail;
use App\Models\MainDB\VirusWinPrizeDetail;
use App\Models\MainDB\WeekStarWin;
use App\Models\MainDB\WinJackpot;
use App\Models\MainDB\WinJackpotNext;
use App\Models\MainDB\WinJackpotPerson;
use App\Models\MainDB\Example;
use App\Models\MainDB\WinLog;
use App\Models\MainDB\About;
use App\Models\MainDB\AboutClassify;
use App\Models\MainDB\AccountLog;
use App\Models\MainDB\ActivityLove;
use App\Models\MainDB\Ad;
use App\Models\MainDB\AdPosition;
use App\Models\MainDB\AllowModule;
use App\Models\MainDB\AllowRule;
use App\Models\MainDB\Article;
use App\Models\MainDB\ArticleCategory;
use App\Models\MainDB\Blacklist;
use App\Models\MainDB\CancelAccount;
use App\Models\MainDB\ChatLog;
use App\Models\MainDB\Config;
use App\Models\MainDB\District;
use App\Models\MainDB\Face;
use App\Models\MainDB\FaceSpecial;
use App\Models\MainDB\FansNotice;
use App\Models\MainDB\FeedBack;
use App\Models\MainDB\FmProtect;
use App\Models\MainDB\FmProtectList;
use App\Models\MainDB\Follow;
use App\Models\MainDB\Footmark;
use App\Models\MainDB\Friend;
use App\Models\MainDB\FundLog;
use App\Models\MainDB\GameJackpot;
use App\Models\MainDB\GameJackpotPerson;
use App\Models\MainDB\GameJackpotPlan;
use App\Models\MainDB\GameJackpotPlanDetail;
use App\Models\MainDB\GameLogDay;
use App\Models\MainDB\GameProtect;
use App\Models\MainDB\GameSpecialUser;
use App\Models\MainDB\{Gift, GiftBackpack, GiftBag, GiftBagDetail, GiftBagReceive, GiftPopularity, GiftPrice, GiftType, GiftWeek, GiveGift, GiveGiftDay, GiftFrame};
use App\Models\MainDB\GoldPrice;
use App\Models\MainDB\GoodNumber;
use App\Models\MainDB\GoodNumberCate;
use App\Models\MainDB\GradeConfig;
use App\Models\MainDB\IpSealLog;
use App\Models\MainDB\JavaCashLog;
use App\Models\MainDB\JavaFreezeLog;
use App\Models\MainDB\Label;
use App\Models\MainDB\LabelCategory;
use App\Models\MainDB\Log;
use App\Models\MainDB\MallCategories;
use App\Models\MainDB\MallOrders;
use App\Models\MainDB\MallProducts;
use App\Models\MainDB\MallProductsPrice;
use App\Models\MainDB\MeetGift;
use App\Models\MainDB\MeetResult;
use App\Models\MainDB\MeetSelect;
use App\Models\MainDB\Messages;
use App\Models\MainDB\Nav;
use App\Models\MainDB\Navigation;
use App\Models\MainDB\Nobility;
use App\Models\MainDB\NobilityBuy;
use App\Models\MainDB\Notice;
use App\Models\MainDB\Order;
use App\Models\MainDB\OutputRadio;
use App\Models\MainDB\Popularity;
use App\Models\MainDB\PopularityLog;
use App\Models\MainDB\Privilege;
use App\Models\MainDB\RechargeCoin;
use App\Models\MainDB\Region;

use App\Models\MainDB\Lisence;
use App\Models\MainDB\UserLisence;
use App\Models\MainDB\LisenceTag;
use App\Models\MainDB\LisenceApply;
use App\Models\MainDB\LisenceComment;
use App\Models\MainDB\LisenceOrder;
use App\Models\MainDB\LisenceOrderLog;
use App\Models\MainDB\LisenceMessage;

use App\Models\MainDB\IndexAdvertisement;
use App\Models\MainDB\ChannelFlux;
use App\Models\MainDB\PayMerchant;

use App\Models\MainDB\{GiveGiftCharm, GiveGiftRich, IndexNav, Microblog, MicroBlogLike, MicroBlogComment, MicroBlogMessage, Single\SingleConfig, Single\SingleOrder, Single\SingleSongList};
use App\Models\MainDB\{Single\SingleDraw, Single\SingleDrawGift, Single\SingleDrawResult};
use App\Models\MainDB\{Single\SingleGiveGift};

use App\Models\MainDB\{Data\DataSummaryDaily,
    Data\DataSummaryDailyUser,
    Data\DataSummaryUser,
    Recommend\RecommendAnchor,
    NobilityConfig,
    Recommend\RecommendHot
};

use App\Models\MainDB\{Auction\AuctionReturnGold,
    Contact,
    GameSugarConfig,
    GameSugarRecord,
    GiftBoxPrizeDetail,
    PersonalPoolUser,
    QaAnswer,
    QaQuestion,
    RechargeLimit,
    RoomManager,
    RoomNewPopularity,
    RoomOnlineUser,
    Teenager,
    TeenagerLog,
    Theme\Theme,
    Theme\ThemeChatLog,
    Theme\ThemeHeadline,
    UserNobilityExp
};
use App\Models\MainDB\{
    Banner, BannerCategory, Connect\ConnectIntimacyLog, Connect\ConnectOpenRecord, Connect\ConnectOpenWinner, Connect\ConnectPrizePool, Connect\ConnectPrizePoolProp, Connect\ConnectPrizePoolPropNext, Connect\ConnectRelation, Connect\ConnectSendRecord, MallOrdersHistory, MallProductsSuitRelation, MallWishlist, Interaction\RoomInteractionChangeSound, Interaction\RoomInteractionPlayMethod, Interaction\RoomInteractionProp, Interaction\RoomInteractionSound, RoomChangeAction, RoomContributionConfig, UserActionBanned, UserChangeAction, WaterdropLog, AppSetting, VersionManagement, VersionSetting, InteractionFace, RoomBackgroundBuyLog, RoomBackgroundBuyLogView, RoomBackgroundProductsPrice, CustomerServiceQuestion, CustomerServiceQuestionKeywords
};

use App\Models\MainDB\{ActivityMessageMark,
    ActivityMessages,
    BroadcastRyLog,
    BroadcastRyRetryLog,
    Connect\ConnectApply,
    Connect\ConnectGiftBuyRecord,
    GiftSuit,
    GiftSuitJoin,
    IpResult,
    Screen\ScreenActivity,
    Screen\ScreenJoinRecord,
    Screen\ScreenLotteryNum,
    Screen\ScreenWinner,
    UserDeviceBanLog,
    UserGiftWallExpLog,
    UserLoginDate,
    GameSugarInfo};


use App\Models\MainDB\GiftWall\{UserGiftWall, UserGiftWallScorePrizeConfig, UserGiftWallExchangeConfig, UserGiftWallPrizeLog};

use App\Models\MainDB\Connection\{
    ConnectionRelation, ConnectionGradeConfig, ConnectionClassConfig, ConnectionCpapply
};
use App\Models\MainDB\Room;

//游戏部分
use App\Models\GameDB\Score;
use App\Models\GameDB\ScoreLog;
use App\Models\GameDB\GameFeedback;

class ElasticsearchServiceProvider extends ServiceProvider
{

    //register
    public function register()
    {
        $this->app->alias('elasticsearch', Client::class);

        $this->app->singleton('elasticsearch', function ($app) {
            return $this->createElasticsearchClient($app);
        });
    }


    /**
     * 创建 Elasticsearch 客户端
     *
     *
     *
     * @return \Elasticsearch\Client
     */
    protected function createElasticsearchClient($app)
    {
        $builder = ClientBuilder::create();


        $builder->setHosts(config('elasticsearch.connections'));
        //$builder->setBasicAuthentication('elastic', 'password');
        $builder->setRetries(config('elasticsearch.retries'));


        return $builder->build();
    }
}
